#include <stdio.h>
int main()
{	   	   	   		 
    int i;
    double s = 0, h, f0, f1, n, a, b;
    printf("Enter n,a,b:");
    scanf("%lf,%lf,%lf", &n, &a, &b);
    h = (b - a) / n;
    f0 = a * a + 2 * a + 1;
    for (i = 0; i < n; i++)
    {	   	   	   		 
        a = a + h;
        f1 = a * a + 2 * a + 1;
        s += (f0 + f1) * h / 2;
        f0 = f1;
    }
    printf("Sum=%lf\n", s);
    return 0;
}